<template>
    <div>
        <h1>{{msg}}</h1>
        <button @click="sendData">向父级传递数据</button>
    </div>
</template>
<script>
export default {
    props:["msg"],
    data(){
        return {
            childMessage:"hello father"
        }
    },
    methods:{
        sendData(){
            this.$emit("sendData",this.childMessage)
        }
    }
}
</script>